﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Cgd.Shell.Data;

public partial class _Default : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		((CgdShellMasterPage)this.Master).SetActiveNavButton("navDefault");

		using(CgdShellDataContext db = new CgdShellDataContext())
		{
			lstNews.DataSource = (from i in db.Documents
								 where i.Category == CgdColumn.NewsUpdates.Value
								 orderby i.Time descending
								 select i).Take(10);
			lstNews.DataBind();

			lstJobs.DataSource = (from i in db.Documents
								  where i.Category == CgdColumn.JobUpdates.Value
								  orderby i.Time descending
								  select i).Take(10);
			lstJobs.DataBind();

			lstTech.DataSource = (from i in db.Documents
								  where i.Category == CgdColumn.TechUpdates.Value
								  orderby i.Time descending
								  select i).Take(10);
			lstTech.DataBind();

			lstDesign.DataSource = (from i in db.Documents
									where i.Category == CgdColumn.DesignUpdates.Value
									orderby i.Time descending
									select i).Take(10);
			lstDesign.DataBind();

			lstDownload.DataSource = (from i in db.Documents
									  where i.Category == CgdColumn.DownloadUpdates.Value
									  orderby i.Time descending
									  select i).Take(10);
			lstDownload.DataBind();
		}
	}
}
